/**
 * Copyright:  Copyright (c) 2013
 *
 * @FileName		: CombinedPaperTeamAction.java
 * @PageName		: 
 * @Date			: 오후 3:46:36
 * @LastModifier	: 최경민
 * @LastModifyDate	: 
 * @LastModifier	: 
 * Change history	:
 */
package com.pulp.production.action;

import java.util.List;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.opensymphony.xwork2.ActionSupport;
import com.pulp.production.service.ProductionInfoService;

/**
 * @author 최경민
 * 
 */
public class CombinedPaperTeamAction extends ActionSupport {
	private static final long serialVersionUID = 7066990226498546172L;
	private String REQUEST_RESULT = "ok";
	static Logger logger = Logger.getLogger(CombinedPaperTeamAction.class);

	private String errorCode = "";
	private List combinedPaperTeamYearList = null;
	private List combinedPaperTeamMonthList = null;
	private List combinedPaperTeamDateList = null;

	/**
	 * @return the rEQUEST_RESULT
	 */
	public String getREQUEST_RESULT() {
		return REQUEST_RESULT;
	}
	/**
	 * @param rEQUEST_RESULT the rEQUEST_RESULT to set
	 */
	public void setREQUEST_RESULT(String rEQUEST_RESULT) {
		REQUEST_RESULT = rEQUEST_RESULT;
	}
	/**
	 * @return the logger
	 */
	public static Logger getLogger() {
		return logger;
	}
	/**
	 * @param logger the logger to set
	 */
	public static void setLogger(Logger logger) {
		CombinedPaperTeamAction.logger = logger;
	}
	/**
	 * @return the errorCode
	 */
	public String getErrorCode() {
		return errorCode;
	}
	/**
	 * @param errorCode the errorCode to set
	 */
	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}
	/**
	 * @return the combinedPaperTeamYear
	 */
	public List getCombinedPaperTeamYear() {
		return combinedPaperTeamYearList;
	}
	/**
	 * @param combinedPaperTeamYear the combinedPaperTeamYear to set
	 */
	public void setCombinedPaperTeamYear(List combinedPaperTeamYear) {
		this.combinedPaperTeamYearList = combinedPaperTeamYear;
	}
	/**
	 * @return the combinedPaperTeamMonth
	 */
	public List getCombinedPaperTeamMonth() {
		return combinedPaperTeamMonthList;
	}
	/**
	 * @param combinedPaperTeamMonth the combinedPaperTeamMonth to set
	 */
	public void setCombinedPaperTeamMonth(List combinedPaperTeamMonth) {
		this.combinedPaperTeamMonthList = combinedPaperTeamMonth;
	}
	/**
	 * @return the combinedPaperTeamDate
	 */
	public List getCombinedPaperTeamDate() {
		return combinedPaperTeamDateList;
	}
	/**
	 * @param combinedPaperTeamDate the combinedPaperTeamDate to set
	 */
	public void setCombinedPaperTeamDate(List combinedPaperTeamDate) {
		this.combinedPaperTeamDateList = combinedPaperTeamDate;
	}

	public String execute() throws Exception {

		try {

			HttpServletRequest request = (HttpServletRequest) ServletActionContext.getRequest();

			ServletContext servletContext = ServletActionContext.getServletContext();
			WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
			ProductionInfoService productionInfoService = (ProductionInfoService) wac.getBean("productionInfoService");
			combinedPaperTeamYearList = productionInfoService.getCombinedPaperTeamYear();
			combinedPaperTeamMonthList = productionInfoService.getCombinedPaperTeamMonth();
			combinedPaperTeamDateList= productionInfoService.getCombinedPaperTeamDate();

			request.setAttribute("combinedPaperTeamYearList", combinedPaperTeamYearList);
			request.setAttribute("combinedPaperTeamMonthList", combinedPaperTeamMonthList);
			request.setAttribute("combinedPaperTeamDateList", combinedPaperTeamDateList);
		} catch (Exception ex) {
			REQUEST_RESULT = "FAILED";
			ex.printStackTrace();
		}
		return REQUEST_RESULT;
	}
}
